Skip to content

sqlparser: make index names optional#4166

Merged
sougou merged 2 commits intovitessio:masterfrom
dt:name-opt
Sep 2, 2018
Merged

sqlparser: make index names optional#4166
sougou merged 2 commits intovitessio:masterfrom
dt:name-opt

Conversation

@dt
Copy link
Copy Markdown
Contributor

@dt dt commented Aug 29, 2018

MySQL accepts index definitions without explicit names, e.g. 'UNIQUE KEY (a, b)'.

Signed-off-by: David Taylor tinystatemachine@gmail.com

{
$$ = ""
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change is good.
Some nits:

  • Existing code always lists the empty rule first. No particular reason, but it's better to follow existing convention.
  • We generally don't mention empty. But there's no harm. However, let's use // instead.
  • Also, lower level rules are listed below higher level ones, which means this should be moved after index_or_key.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! reordered, just removed the comment to stick with convention, and moved it below index_of_key.

@sougou
Copy link
Copy Markdown
Contributor

sougou commented Sep 1, 2018

Need conflicts resolved.

dt added 2 commits September 2, 2018 14:14
In some cases (versions?) mysqldump appears to emit default expressions with the parens in the CURRENT_TIMESTAMP call.
This normalizes to no parens either way in the AST.

Signed-off-by: David Taylor <tinystatemachine@gmail.com>
MySQL accepts index definitions without explicit names, e.g. 'UNIQUE KEY (a, b)'.

Signed-off-by: David Taylor <tinystatemachine@gmail.com>
@dt
Copy link
Copy Markdown
Contributor Author

dt commented Sep 2, 2018

Rebased and regenerated sql.go on top of #4168, in the hope of avoiding merge conflicts after #4168 merges.

@sougou
Copy link
Copy Markdown
Contributor

sougou commented Sep 2, 2018

I'm surprised (and worried) that the previous merge didn't cause a conflict with sql.go on this PR.

@sougou sougou merged commit ecd4cc7 into vitessio:master Sep 2, 2018
@dt
Copy link
Copy Markdown
Contributor Author

dt commented Sep 2, 2018

I rebased it on top of #4168 while I was amending it (since that one was already approved) to avoid the conflict at merge — so this briefly briefly two commit PR until that one merged, at which point it went back to being just the one, but still applying cleanly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants